﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="frm_Carreras.aspx.cs" Inherits="ED_Nivelacion.PresentacionWeb.Carreras" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="Form1" runat="server">

        <script>
            function show() {
                document.write("<head id='head2' runat='server'></head>");
            }
        </script>

        <script>
            $(document).ready(function () {

                $(document).on("click", ".borrar", function () {

                    var id_asignatura = $(this).data('id_asignatura');

                    alert(id_asignatura);
                    $('#ContentPlaceHolder1_idEliminar').val(id_asignatura);

                });


                $(document).on("click", ".editar", function () {

                    var id = $(this).data("id");
                    var carrera = $(this).data("carrera");
                    var jornada = $(this).data("jornada");
                    var dist = $(this).data("dist");

                    $('#ContentPlaceHolder1_txt_Editar').val(id);
                    $('#ContentPlaceHolder1_txt_EditarJ').val(dist);
                    $('#ContentPlaceHolder1_txt_Carrera').val(carrera);
                    $('#ContentPlaceHolder1_cbm_Jornada').val(jornada);

                    $('#ContentPlaceHolder1_btn_Editar').show();
                    $('#ContentPlaceHolder1_Btn_Guardar').hide();
                });

                $(document).on("click", ".guardar", function () {

                    $('#ContentPlaceHolder1_btn_Editar').hide();
                    $('#ContentPlaceHolder1_Btn_Guardar').show();
                });
            });


            function limpiar() {
                $('#ContentPlaceHolder1_txt_Editar').val("");
                $('#ContentPlaceHolder1_txt_Carrera').val("");
                $('#ContentPlaceHolder1_cbm_Jornada').val("0");
            }


        </script>

        <% ED_Nivelacion.Negocios.DistribucionCarreraJornada_C _objCarrera_C = new ED_Nivelacion.Negocios.DistribucionCarreraJornada_C(); %>
        <!-- /. ROW  -->


        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Timer ID="Timer1" runat="server">
        </asp:Timer>
        <div class="col-lg-12">

            <div class="portlet portlet-default">
                <div class="portlet-heading">
                    <div class="portlet-title">
                        <h4>Agregar Materias</h4>


                    </div>
                    <div class="clearfix">
                        <div class="portlet-widgets">
                            <a class="btn btn-success btn-xs guardar" data-toggle="modal" data-target="#AgregarCarrera" onclick="limpiar()"><i class="fa fa-plus">Agregar </i></a>
                        </div>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="table-responsive">
                        <table id="example-table" class="table table-striped table-bordered table-hover table-green">
                            <thead>

                                <tr>
                                    <th>#</th>
                                    <th>Carrera</th>
                                    <th>Jornada</th>
                                    <th>Accion</th>
                                </tr>
                            </thead>
                            <tbody>
                                <%foreach (var item in _objCarrera_C.ObtenerCarreraJornada())
                                  {
                                                  
                                %>
                                <tr>
                                    <td><%=item.idCarrera_Jornada %></td>
                                    <td><%=item.Carrera %></td>
                                    <td><%=item.Jornada %></td>
                                    <td class="center"><a class="btn btn-orange btn-sm editar" data-toggle="modal" data-target="#AgregarCarrera" data-id="<%=item.idCarrera %>" data-dist="<%=item.idCarrera_Jornada%>" data-carrera="<%=item.Carrera %>" data-jornada="<%=item.idJornada %>"><i class="fa fa-pencil"></i>MODIFICAR</a>
                                    </td>
                                </tr>
                                <%} %>
                            </tbody>
                            <asp:TextBox ID="idEliminar" runat="server" CssClass="hidden"></asp:TextBox>
                        </table>
                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.portlet-body -->
            </div>
            <!-- /.portlet -->

        </div>


        <div class="col-lg-22">
            <div class="modal modal-flex fade" id="AgregarCarrera" tabindex="-1" role="dialog" aria-labelledby="flexModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="flexModalLabel">Agregar Carrera</h4>
                        </div>
                        <div id="Div1" class="modal-body" runat="server">
                            <div class="panel panel-default">

                                <div class="panel-body">
                                    <asp:TextBox ID="txt_Editar" runat="server" CssClass="hide"></asp:TextBox>
                                    <asp:TextBox ID="txt_EditarJ" runat="server" CssClass="hide"></asp:TextBox>
                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th colspan="2">Carrera</th>

                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>Descripcion</td>
                                                <td>
                                                    <asp:TextBox ID="txt_Carrera" required runat="server" Width="300px"></asp:TextBox>
                                                    <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID="txt_Carrera" FilterType="LowercaseLetters,UppercaseLetters,Custom" ValidChars="ñÑáéíóúÁÉÍÓÚ " />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>Jornada
                                                </td>
                                                <td>
                                                    <asp:DropDownList ID="cbm_Jornada" runat="server" Enabled="true" AppendDataBoundItems="true">
                                                        <asp:ListItem Value="" Selected="True">Escoja una opción</asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <asp:Button ID="Btn_Guardar" runat="server" CssClass="btn btn-primary btn-sm" Text="GUARDAR" OnClick="Btn_Guardar_Click" />
                            <asp:Button ID="btn_Editar" runat="server" CssClass=" btn btn-primary btn-sm" Text="EDITAR" OnClick="btn_Editar_Click" />

                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
            <!-- /.modal -->
        </div>


    </form>
</asp:Content>
